# -*- coding: utf-8 -*-
#Importamos modulos necesarios para crear formularios
import datetime
from django import forms
from django.contrib.admin import widgets
from django.forms import ModelForm
from django.forms.models import modelformset_factory
from django.forms.extras.widgets import SelectDateWidget

#Importamos modulos con elementos definidos por el usuario...
from models import localidades, provincias, paises, perfil
from choices import genero, estado_civil, tipo_estado, tipo_usuario


#Definicion de formularios de trabajo
class Flogin(forms.Form):
	username = forms.CharField(max_length=30, label="", required =True, initial='')
	password = forms.CharField(max_length=30, label="", widget= forms.PasswordInput, initial='')
	remember = forms.BooleanField(label="", help_text="Recordame", required=False)


class Fregistracion(forms.Form):
	username = forms.CharField(max_length=30, label="Username", required=True)
	email = forms.EmailField(label="Email")
	password1 = forms.CharField(max_length=25, widget= forms.PasswordInput,label="Password", required=True)
	password2 = forms.CharField(max_length=25, widget= forms.PasswordInput,label="Repita la Password", required=True)
	nombre = forms.CharField(max_length=30, label="Nombres", required=True)
	apellido = forms.CharField(max_length=30, label="Apellido", required=True)


class Fnewemail(forms.Form):
	username = forms.CharField(max_length=30, label="Username", required =True)
	email = forms.EmailField(label="Email")


class Fchpass(forms.Form):
	password = forms.CharField(max_length=25, widget= forms.PasswordInput,label="Password Actual", required=True)
	password1 = forms.CharField(max_length=25, widget= forms.PasswordInput,label="Nueva Password", required=True)
	password2 = forms.CharField(max_length=25, widget= forms.PasswordInput,label="Nueva Password", required=True)


class Fperfil(forms.Form):
	genero = forms.CharField(max_length=1, label="Genero", widget=forms.Select(choices=genero))
	nacimiento = forms.DateField(label="Fecha de Nacimiento", widget= SelectDateWidget(years=range(datetime.date.today().year,datetime.date.today().year-100,-1)))
	telefono = forms.CharField(label="Telefono",required=False)
	estado = forms.CharField(label="Estado Civil",required=False,widget=forms.Select(choices=estado_civil))
	paises = forms.ModelChoiceField(paises.objects.all())
	provincia = forms.ModelChoiceField(provincias.objects.all())
	localidad = forms.ModelChoiceField(localidades.objects.all())
	direccion = forms.CharField(label="Direccion", required=False)


class Favatar(forms.Form):
	foto= forms.FileField(label="Avatar")


class Fmensaje(forms.Form):
	asunto= forms.CharField(max_length=50, label="Titulo", required =True)
	texto= forms.CharField(max_length=500,label="Texto", widget=forms.Textarea(attrs={'style':'width:500; height:100px'}), required =True)


class Famonestacion(forms.Form):
	estado= forms.CharField(label="Estado",required=True,widget=forms.Select(choices=tipo_estado))
	dias = forms.IntegerField(label="Dias",required=False, initial=7)
	descripcion= forms.CharField(max_length=500,label="Motivo", widget=forms.Textarea(attrs={'style':'width:500; height:100px'}), required =True)


class Ftipousuario(forms.Form):
	tipo= forms.CharField(label="Estado",required=True,widget=forms.Select(choices=tipo_usuario))